home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PCTV3N3 / TESTPP.C < prev    next >
Text File  |  1992-01-10  |  598b  |  38 lines

  1. #include <stdarg.h>
  2. #include <stdio.h>
  3.  
  4. #include "pushpop.h"
  5.  
  6. void showElems(int n, ...)
  7. {
  8. int i;
  9. va_list elems;
  10.  
  11. for (i = 0, va_start(elems, n); i < n; i++)
  12.   printf("%d ", va_arg(elems, int));
  13. va_end(elems);
  14. putchar('\n');
  15. }
  16.  
  17. void showArray(int n, int a[])
  18. {
  19. int i;
  20.  
  21. for (i = n - 1; i >= 0; i--)
  22.   va_push(int, a[i]);
  23. showElems(n);
  24. va_pop(int, n);
  25. }
  26.  
  27. int main()
  28. {
  29. int a[] = { 1, 8, -6, 3, 9, 4, 2, -1 };
  30.  
  31. puts("Testing pushpop ...");
  32. showElems(3, 6, 7, 9);
  33. showArray(sizeof(a) / sizeof(int), a);
  34. puts("Returned successfully ... pushpop OK.");
  35.  
  36. return (0);
  37. }
  38.